package view.user;

import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JPanel;

import controller.ActionEvents.ActionHandler;

import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JRadioButton;
import javax.swing.JButton;
import javax.swing.JList;

public class CreateAccount extends JPanel {

	private ActionHandler actionHandler;
	private JLabel lblNewAccountName;
	private JTextField txtNewAccountName;
	private JRadioButton rdbtnCreateAccount;
	private JRadioButton rdbtnDeleteAccount;
	private JList listDeleteAccount;
	private JButton btnSubmit;
	private final ButtonGroup buttonGroup = new ButtonGroup();
	private JLabel lblCreateAccount;
	/**
	 * Create the panel.
	 */
	public CreateAccount(ActionHandler actionHandler) {
		this.actionHandler = actionHandler;

		setLayout(null);
		setPreferredSize(new Dimension(750, 372));
		
		lblCreateAccount = new JLabel("My balance"); // Creates object lblMyBalance.
		lblCreateAccount.setFont(new Font("Euphemia UCAS", Font.PLAIN, 28));
		lblCreateAccount.setBounds(321, 6, 163, 39);
		add(lblCreateAccount); // Ads JLabel to JPanel.
		
		lblNewAccountName = new JLabel("Account name");
		lblNewAccountName.setBounds(6, 128, 90, 16);
		add(lblNewAccountName);
		
		txtNewAccountName = new JTextField();
		txtNewAccountName.setBounds(108, 122, 134, 28);
		add(txtNewAccountName);
		txtNewAccountName.setColumns(10);
		
		rdbtnCreateAccount = new JRadioButton("Create account");
		rdbtnCreateAccount.setBounds(82, 87, 141, 32);
		rdbtnCreateAccount.addActionListener(actionHandler);
		rdbtnCreateAccount.setActionCommand("addAccount");
		buttonGroup.add(rdbtnCreateAccount);
		add(rdbtnCreateAccount);
		
		rdbtnDeleteAccount = new JRadioButton("Delete account");
		rdbtnDeleteAccount.setBounds(471, 87, 141, 32);
		rdbtnDeleteAccount.addActionListener(actionHandler);
		rdbtnDeleteAccount.setActionCommand("deleteAccount");
		buttonGroup.add(rdbtnDeleteAccount);
		add(rdbtnDeleteAccount);
		
		
		listDeleteAccount = new JList();
		listDeleteAccount.setBounds(471, 122, 134, 105);
		add(listDeleteAccount);
		
		btnSubmit = new JButton("Submit");
		btnSubmit.setBounds(271, 278, 117, 29);
		btnSubmit.addActionListener(actionHandler);
		btnSubmit.setBorderPainted(false);
		btnSubmit.setContentAreaFilled(false);
		btnSubmit.setActionCommand("submitAccountChange");
		add(btnSubmit);
	}
	/**
	 * @return the rdbtnCreateAccount
	 */
	public JRadioButton getRdbtnCreateAccount() {
		return rdbtnCreateAccount;
	}
	/**
	 * @param rdbtnCreateAccount the rdbtnCreateAccount to set
	 */
	public void setRdbtnCreateAccount(JRadioButton rdbtnCreateAccount) {
		this.rdbtnCreateAccount = rdbtnCreateAccount;
	}
	/**
	 * @return the rdbtnDeleteAccount
	 */
	public JRadioButton getRdbtnDeleteAccount() {
		return rdbtnDeleteAccount;
	}
	/**
	 * @param rdbtnDeleteAccount the rdbtnDeleteAccount to set
	 */
	public void setRdbtnDeleteAccount(JRadioButton rdbtnDeleteAccount) {
		this.rdbtnDeleteAccount = rdbtnDeleteAccount;
	}
	/**
	 * @return the listDeleteAccount
	 */
	public JList getListDeleteAccount() {
		return listDeleteAccount;
	}
	/**
	 * @param listDeleteAccount the listDeleteAccount to set
	 */
	public void setListDeleteAccount(JList listDeleteAccount) {
		this.listDeleteAccount = listDeleteAccount;
	}
	/**
	 * @return the txtNewAccountName
	 */
	public JTextField getTxtNewAccountName() {
		return txtNewAccountName;
	}
	/**
	 * @return the lblNewAccountName
	 */
	public JLabel getLblNewAccountName() {
		return lblNewAccountName;
	}
	/**
	 * @return the btnSubmit
	 */
	public JButton getBtnSubmit() {
		return btnSubmit;
	}
}
